﻿<?php
$msg=$_POST["message"];
$name=$_POST["user"];
//$new_msg = substr($msg,0,strlen($msg-1));
$file=fopen("src\json\chatLog.json","r+") or exit("Unable to open file!");
clearstatcache();
$fp = filesize("src\json\chatLog.json")-2;
$text = ",{\"name\":\"".$name."\",\"text\":\"".$msg."\"}]}";
fseek($file,$fp);
fwrite($file,$text);
fclose($file);
?>